﻿using System;
namespace HBase {
    public static class GuidangFactray {
        //public const GKDBType prefixal = GKDBType.oracle;
        public const String prefixal = "mongo";

        public static T getDal<T>() {
            Type type = typeof(T);
            String fullName = type.FullName;
            int index = fullName.LastIndexOf(".") + 1;
            String dllName = fullName.Substring(0 ,index) + prefixal + "." + fullName.Substring(index + 1);
            Type implType = type.Assembly.GetType(dllName);//加载类型
            if( implType == null ) {
                return default(T);
            }
            Type[] types = implType.GetInterfaces();
            object o = Activator.CreateInstance(implType);
            T t = ( T ) o;
            return t;
        }
    }
}
